package com.gxgeek.order.controller;

import com.gxgeek.order.config.GirlConfig;
import com.gxgeek.product.client.ProductClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.data.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author gaoxing
 * @create 2018-03-26 上午9:38
 */
@RestController
//@RefreshScope
public class ClientController {
    @Autowired
    ProductClient productClient;


    @Value(value = "${env}")
    private String env;


    @Autowired
    GirlConfig girlConfig;

    @GetMapping("/printEnv")
    public String printEnv() {
        return girlConfig.getAge()+girlConfig.getName();
    }

    @GetMapping("/getProductMsg")
    public String getProductMsg(){
//        System.out.println(serviceInstance.getHost());
//        String s  = restTemplate.getForObject("http://PRODUCT-SERVICE/msg", String.class);
        String s = productClient.productMsg();
        return s;
    }
}
